// 获取环境变量
const NODE_ENV = process.env.NODE_ENV || 'development'

// 数据库配置
const dbConfig = {
  development: {
    host: 'localhost',
    port: 3306,
    user: 'root',
    password: 'wan320911',
    database: 'warehouse'
  },
  production: {
    host: process.env.DB_HOST || 'localhost',
    port: process.env.DB_PORT || 3306,
    user: process.env.DB_USER || 'root',
    password: process.env.DB_PASSWORD || '',
    database: process.env.DB_NAME || 'warehouse'
  }
}

module.exports = {
  port: process.env.PORT || 3012,
  env: NODE_ENV,
  db: dbConfig[NODE_ENV],
  jwt: {
    secret: process.env.JWT_SECRET || 'your-secret-key',
    expiresIn: '24h'
  }
}

